package it.mbus.bz;

import it.mbus.component.UserComponent;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;



public class Login extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
    
        
        final Button button = (Button) findViewById(R.id.btnEntra);
        final EditText us = (EditText) findViewById(R.id.editText1);
        final EditText ps = (EditText) findViewById(R.id.editText2);
        final CheckBox sa = (CheckBox) findViewById(R.id.salva);
        
        final TextView info = (TextView) findViewById(R.id.info);
        
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
          String u=  us.getText().toString();
          String p=  ps.getText().toString();
          boolean s = sa.isChecked();
          
          if(u.equals("")||p.equals("")){
          info.setText("Utente o Password \nassenti");}
          else{
        	  //controlla login ed entra, TODO: salva
        	  if(UserComponent.login()){
        		  //login effettuato con successo
        	  }
        	  else{
        		  //psw o usr ERRATI
        	  }
        	 
        	  
          }
          
          
          
          
        }
    });
}
}
